package org.budo.elasticsearch.jdbc.driver.resultset;

import java.sql.SQLException;
import java.util.Map;

import org.budo.jdbc.driver.resultset.impl.ObjectArrayResultSet;
import org.elasticsearch.search.SearchHit;

/**
 * @author lmw
 */
public class SearchHitArrayResultSet extends ObjectArrayResultSet<SearchHit> {
    @Override
    protected Object getColumnValueRaw(String columnLabel) {
        int rowNumber = this.getRowNumber();
        SearchHit searchHit = this.getValueArray()[rowNumber];
        Map<String, Object> source = searchHit.getSource();
        return source.get(columnLabel);
    }

    /**
     * 覆盖日志
     */
    @Override
    public void close() throws SQLException {
    }
}